<?php


namespace App\Http\Admin\Controllers;

use Illuminate\Http\Request;
use App\Http\Admin\Controllers\Controller as Controller;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Redis;

/*
 *  案件表接口
 *  @author 小林《1814992057@qq.com》
 *  @datetime   2019/8/23
*/

class CasePlaintiffController extends Controller{

    public function __construct(Request $request)
    {
        $token = getToken($request);
        $uid = Redis::get("code:" . $token);
        $this->uid = $uid;
    }



    public function select_plaintiff($cid){
        $data=DB::table("c_plaintiff")->where('cid',$cid)->get();

        return [
            'status_code'      => 200,
            'message'     =>  '查询成功',
            'data' => $data
        ];

    }


    public function add_plaintiff(Request $request){
        $data=$request->only('status','name','age','cid','sex');
        
        $res=DB::table('c_plaintiff')->insertGetId($data);
        return [
            'status_code'      => 200,
            'message'     =>  '创建成功',
            'data' => $res
        ];

    }

    public function delete_plaintiff($plaId){
        $res=DB::table("c_plaintiff")->where("id",$plaId)->delete();
        return [
            'status_code'      => 200,
            'message'     =>  '删除成功',
            'data' => $res
        ];
    }

}